package edu.bu.grocerylist.dao;

import java.util.List;

import edu.bu.grocerylist.model.GroceryUser;

public interface IGroceryUserDao {

	/**
	 * Retrieves all of the users of the Grocery application
	 * @return
	 */
	public List<GroceryUser> getAllUsers();
	
	/**
	 * Retrieves a user based on username/password
	 * @param username
	 * @param password
	 * @return The authenticated user, or null if no user was found (aka incorrect password/username)
	 */
	public GroceryUser getUserByCredentials(String username, String password);
	
	/**
	 * Retrieves the grocery users with a specified username
	 * @param username
	 */
	public List<GroceryUser> getUsersByUsername(String username);
	
	/**
	 * Retrieves user by a specific userid
	 * @param userId
	 * @return
	 */
	public GroceryUser getUserByUserId(int userId);
	
	
	/**
	 * Creates a new user into the system
	 * @param newUser The user to save
	 * @return the new userId of the saved user
	 */
	public int saveUser(GroceryUser newUser);
	
	/**
	 * Saves a user object to the database
	 * @param userToUpdate
	 * @return the number of rows affected
	 */
	public int updateUser(GroceryUser userToUpdate);

	/**
	 * Retrieves the user by the username
	 * @param username username of the user to find
	 * @return The found user
	 */
	public GroceryUser getUserByUserId(String username);
	
	/**
	 * Deletes the user from the database
	 * @param user The user to delete
	 */
	public void deleteUser(GroceryUser user);

}